//
//  LYErrorDomain.swift
//  RxSwift_Practice
//
//  Created by 李永彬 on 2020/4/28.
//  Copyright © 2020 李永彬. All rights reserved.
//

import Foundation
/**
    Errors that can occur when interacting with BluetoothKit.
    - InterruptedByUnavailability(cause): Will be returned if Bluetooth ie. is turned off while performing an action.
    - FailedToConnectDueToTimeout: The time out elapsed while attempting to connect to a peripheral.
    - RemotePeerNotConnected: The action failed because the remote peer attempted to interact with, was not connected.
    - InternalError(underlyingError): Will be returned if any of the internal or private classes returns an unhandled error.
 */
public enum LYError: Error {
//    case interruptedByUnavailability(cause: BKUnavailabilityCause)
    case failedToConnectDueToTimeout
    case remotePeerNotConnected
    case internalError(underlyingError: Error?)
}

public enum LYBCCode: Int, Error
{
    case LYBCCodeBLEUnavailable = 9     // 设备不可用，蓝牙未打开
    case LYBCCodeBLEDisconnected = 13
    case LYBCCodeBLEConnecting = 12   // 正在连接
    case LYBCCodeBLEException = 11      // 蓝牙异常，手机系统bug，导致无法扫描出外设服务和特征
    case LYBCCodeRequestTimeout = 14
    case LYBCCodeRequestFailed = 15
    case LYBCCodeConnectTimeout = 20
    case LYBCCodeSearchTimeout = 21
    case LYBCCodeDisconnectTimeout = 22
    case LYBCCodeConnectInexistentDevice = 27
    case LYBCCodeConnectRepeat = 28
    case LYBCCodeConnectOverrided = 29
    case LYBCCodeDataFormatError = 30
    case LYBCCodeParamsError = 31
    case LYBCCodeTaskCancelError = 32
    case LYBCCodePowerLowError = 60
    case LYBCCodeDeviceUnsuport = 256
    case LYBCCodeOtaError = 90
    case LYBCCodeRequestOverrided = 100  // 请求被覆盖
}


